package kaa.archivator;

import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;


public class MyFileErasor extends SimpleFileVisitor<Path> {
    @Override
    public FileVisitResult postVisitDirectory(Path folder, IOException ex) throws IOException

    {
        Files.deleteIfExists(folder);
        return FileVisitResult.CONTINUE;
    }

    @Override
    public FileVisitResult visitFile(Path file,
                                     BasicFileAttributes attr) throws IOException {
        Files.deleteIfExists(file);
        return FileVisitResult.CONTINUE;
    }

}
